#include "P18F4455.INC"

LSR16   MACRO   VAR16
        BCF     STATUS, C       ; Clear carry
        RRCF    (VAR16)+1,F     ; Rotate high byte right
        RRCF    (VAR16),F       ; Rotate low byte right
        ENDM

CODE
asm_direct
;Start Conversie
	BSF ADCON0, GO

;Asteapta conversie
	TEST_CONV:
	BTFSC	ADCON0, GO
	BRA		TEST_CONV

;divide by 4 (result >> 2
	LSR16 ADRESL	
	LSR16 ADRESL

; SetDCPWM1(y);
	MOVFF 	 ADRESL,	CCPR1L
	BCF		CCP1CON, 4
	
	RETURN
;end asm_fir

; export so linker can see it
GLOBAL asm_direct
END